package com.zhangjun.socket.handler;

import com.zhang.view.chat.IChatMethod;
import com.zhangjun.application.UIService;
import com.zhangjun.chat.protocol.msg.MsgResponse;
import com.zhangjun.socket.MyBizHandler;
import io.netty.channel.Channel;
import javafx.application.Platform;

public class MsgHandler extends MyBizHandler<MsgResponse> {

    public MsgHandler(UIService uiService) {
        super(uiService);
    }
    @Override
    public void channelRead(Channel channel, MsgResponse msg) {
        IChatMethod chat = uiService.getChat();
        Platform.runLater(() -> {
            chat.addTalkMsgUserLeft(msg.getFriendId(), msg.getMsgText(), msg.getMsgType(), msg.getMsgDate(), true, false, true);
        });
    }
}
